<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: CHJYPC
  Date: 2021/6/13
  Time: 15:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>公告管理</title>
    <link rel="stylesheet" type="text/css" href="${rootPath}resources/css/announcement.css"/>
    <link rel="stylesheet" type="text/css" href="${rootPath}resources/css/button.css"/>
</head>
<body onload=" tipToView('${add}','${delete}','${update}')">

<div class="wrapper">
    <%--<div class="header"><h2 class="headerH" >系统公告</h2> <h3 class="headerHclock" id="headClock"></h3></div>--%>
    <div class="header"><h2 class="headerH"> 公告管理</h2></div>
    <%--<a href="javaScript:addAnnounce('${alsUser.username!=null?alsUser.username:""}')">添加公告</a>--%>
    <div class="main">
        <div class="divAdd">
            &emsp; <a href="javaScript:addAnnounce('${alsUser.username!=null?alsUser.username:""}')"
                      class="small blue button">添加公告</a>
        </div>
        <table class="mainTable">
            <thead>
            <tr>

                <%--<th>Savings</th>--%>
            </tr>
            <tr>
                <th>序号</th>
                <th>公告发布者</th>
                <th>公告标题</th>
                <th>发布日期</th>
                <th>操作</th>
            </tr>
            </thead>

            <tbody>
            <c:set var="sum" value="1"/>
            <c:forEach var="list" items="${announcement}">

                <tr>
                    <td>
                            ${sum}
                    </td>

                    <td>
                        <div class="noticePublisher"> ${list.publisher} </div>
                    </td>
                    <td>
                        <div class="noticeTitle"> ${list.titile} </div>
                    </td>
                    <td>
                        <div class="noticeDate">${list.notice_date}</div>
                    </td>
                    <td>
                        <div class="opUpdateOrdelete">
                            <a href="javaScript:updataAnnounce('${list.noticeID}','${list.publisher}','${list.titile}','${list.notice_content}','${list.notice_date}')"
                               class="small blue button">编辑</a>
                            <a href="javascript:subToServlet('${list.noticeID}')" class="small red button">删除</a>
                        </div>
                    </td>
                </tr>

                <c:set var="sum" value="${sum+1}"/>
            </c:forEach>
            <tr></tr>
            </tbody>
        </table>


        <%--<ul class="mainUL">--%>
        <%--<c:set var="sum" value="1"/>--%>
        <%--<c:forEach var="list" items="${announcement}">--%>
        <%--<li>--%>
        <%--<div class="noticeTitle"> ${list.titile} </div>--%>
        <%--<div class="noticeDate">发布日期：${list.notice_date}</div>--%>
        <%--<div class="opUpdateOrdelete">--%>
        <%--<a href="javaScript:updataAnnounce('${list.noticeID}','${list.publisher}','${list.titile}','${list.notice_content}','${list.notice_date}')">编辑</a>--%>
        <%--<a href="javascript:subToServlet('${list.noticeID}');">删除</a>--%>
        <%--</div>--%>
        <%--</li>--%>
        <%--<c:set var="sum" value="${sum+1}"/>--%>
        <%--</c:forEach>--%>
        <%--</ul>--%>
    </div>
</div>


<div style="display:none">
    <form id="deleteAnnoucementForm" action="Announcement?op=1" method="post">
        <input type="text" name="annoucementId" id="divAnnouncement" value="">
    </form>
</div>


<div class="seeAnnouncement" id="divSeeAnnouncement" style="display: none">
    <input type="button" class="closeInput" value="关闭" onclick="closeAnnouncement()">
    <div class="seeAnnouncementTitle">
        <h3 id="divSeeAnnouncementTitle" ></h3>
    </div>

    <form id="addOrUpdateAnnoucementForm" action="Announcement?op=2" method="post">

        <input type="text" name="AnnouncementId" id="AnnouncementId" hidden value="">
        <label for="AnnouncementFooterPublisher"> &emsp;发布者：<input type="text" name="AnnouncementFooterPublisher"
                                                                   id="AnnouncementFooterPublisher" readonly
                                                                   value=""></label>
        <br>

        <label for="AnnouncementTitle">公告标题：<input type="text" name="AnnouncementTitle" id="AnnouncementTitle"
                                                   value=""></label>
        <br>
        <label for="AnnouncementContent"> 公告内容：</label>
        <br>

        <%--<input type="text" name="AnnouncementContent" id="AnnouncementContent" maxlength="300" value="" style="width: 80%;height: 50%">--%>

        <textarea cols="70" rows="20" style="width: 80%;height: 50%" name="AnnouncementContent" id="AnnouncementContent"
                  maxlength="300"></textarea>
        <input type="submit" value="保存" onclick="return saveAnnouncement(this.form)">
    </form>

</div>

<script type="text/javascript" src="${rootPath}resources/js/announcement/announcement.js"></script>
</body>
</html>
